//*****************************************************************************
//**************** (C) 2007 by Eleven Engineering Incorporated ****************
//*****************************************************************************
//**
//**		Tabs:	This file looks best with tab stops set every 6 spaces.
//**
//*****************************************************************************
//*****************************************************************************
//**
//** File:		routines.asm
//** Project:	Simple Sample Project for WHAM4
//** Revised:	
//**
//** Description:	various subroutines
//**             
//**              
//**              
//**
//*****************************************************************************
//*****************************************************************************



 //Stop Thread1
//		mov	r3,1<<_SCU_semaphore
//		outp	r3,SCUdown
		ld	r2,SCUstop_status
		bis	r2,r2,_Thread1
		st	r2,SCUstop_status
		outp	r2,SCUstop
//		outp	r3,SCUup

//-----------------------------------------------
//setup state for thread1
//set r7 = stack pointer
//set program counter = Enter_Thread1
		mov   r0,T1_SP
		mov   r1,Enter_Thread1
		mov   r2,_Thread1<<3 | 7
//		mov	r3,1<<_SCU_semaphore
//		outp	r3,SCUdown
		outp  r2,SCUpntr
		outp  r1,SCUpc					//set Program counter
		outp	r0,SCUreg					//set Stack Pointer
//		outp	r3,SCUup

//Start Thread1
//		mov	r3,1<<_SCU_semaphore
//		outp	r3,SCUdown
		ld	r2,SCUstop_status
		bic	r2,r2,_Thread1
//		st	r2,SCUstop_status
		outp	r2,SCUstop
